# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=squashfs-tools
pkgver=4.5.1
pkgrel=1
pkgdesc="Tools for squashfs, a highly compressed read-only filesystem for Linux"
url="https://github.com/plougher/squashfs-tools"
arch="all"
license="GPL-2.0-or-later"
options="!check" # no testsuite
makedepends="zlib-dev xz-dev lzo-dev lz4-dev attr-dev zstd-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/plougher/squashfs-tools/archive/$pkgver.tar.gz
	fix-compat.patch
	"

# secfixes:
#   4.5-r1:
#     - CVE-2021-41072
#   4.5-r0:
#     - CVE-2021-40153

build() {
	make -C squashfs-tools XZ_SUPPORT=1 LZO_SUPPORT=1 LZ4_SUPPORT=1 ZSTD_SUPPORT=1
}

package() {
	install -D -m 0755 -t "$pkgdir/usr/bin" \
	        'squashfs-tools/mksquashfs' \
	        'squashfs-tools/unsquashfs' \
	        ;

	ln -f -s 'unsquashfs' "$pkgdir/usr/bin/sqfscat"
	ln -f -s 'unsquashfs' "$pkgdir/usr/bin/sqfstar"
}

sha512sums="
b3934ea1e26c7508110312711465644a6d9674b6b5332a7d011e191fa3c1d4b8be694214794a0f6005263d0f4e18bab96af2f7ed66a178f8e3bb3a781cd44896  squashfs-tools-4.5.1.tar.gz
157379cf4bafb72d717f14b1bc5dc350c97a9e68a7018e0febba4b1e59f9fd90c1de8485c4ffc48a035b53be8c3aa62046281291664bee4699100cec637b0bfa  fix-compat.patch
"
